<template>
  <section @click="handleGallaryClick">
    <div class="wrapper">
      <swiper :options="swiperOptions">
        <!-- slides -->
        <swiper-slide v-for="(item, index) in imgs" :key="index">
        <img :src="item" alt="#"/>
        </swiper-slide>
        <!-- Optional controls -->
        <div class="swiper-pagination"  slot="pagination"></div>
      </swiper>
    </div>
  </section>
</template>
<script>
export default {
  name: 'CommonGallary',
  props: {
    imgs: {
      type: Array,
      defalut () {
        return []
      }
    }
  },
  data () {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observeParents: true,
        observer: true
      }
    }
  },
  methods: {
    handleGallaryClick () {
      this.$emit('close')
    }
  }
}
</script>
<style lang="stylus" scoped>
section >>> .swiper-container
  overflow: inherit
section
  height: 100%
  z-index: 2
  position: fixed
  top: 0
  bottom: 0
  left: 0
  right: 0
  background: #000
  display: flex
  flex-direction: column
  justify-content: center
.wrapper
  height: 0
  padding-bottom: 100%
.wrapper img
  width: 100%
  height: 100vw
.swiper-pagination
  color: #fff
  bottom: -2rem
</style>
